home *** CD-ROM | disk | FTP | other *** search
/ AmigActive 2 / AACD 2.iso / AACD / Magazine / GraphicsCards / StormMesa / mklib.openbsd < prev    next >
Text File  |  1998-12-15  |  1KB  |  52 lines

  1. #!/bin/sh
  2.  
  3. # Make a OpenBSD shared library
  4. # contributed by thomas graichen (graichen@OpenBSD.org)
  5.  
  6. #--identification------------------------------------------------------
  7.  
  8. # $Id: mklib.openbsd,v 1.6 1997/10/21 23:32:31 brianp Exp $
  9.  
  10. # $Log: mklib.openbsd,v $
  11. # Revision 1.6  1997/10/21 23:32:31  brianp
  12. # now takes major and minor version arguments
  13. #
  14.  
  15. #--common--------------------------------------------------------------
  16.  
  17. # Usage:  mklib libname major minor file.o ...
  18. #
  19. # First argument is name of output library (LIBRARY)
  20. # Second arg is major version number (MAJOR)
  21. # Third arg is minor version number (MINOR)
  22. # Rest of arguments are object files (OBJECTS)
  23.  
  24. LIBRARY=$1
  25. shift 1
  26.  
  27. MAJOR=$1
  28. shift 1
  29.  
  30. MINOR=$1
  31. shift 1
  32.  
  33. OBJECTS=$*
  34.  
  35. #--platform------------------------------------------------------------
  36.  
  37. set -x
  38.  
  39. LIBRARY=`basename $LIBRARY .so`
  40.  
  41. VERSION="${MAJOR}.${MINOR}"
  42.  
  43. echo "Building PIC library $LIBRARY"
  44. rm -f ${LIBRARY}_pic.a ${LIBRARY}.so.${VERSION}
  45. ar cq ${LIBRARY}_pic.a ${OBJECTS}
  46. ranlib ${LIBRARY}_pic.a
  47.  
  48. ld -x -Bshareable -Bforcearchive -o ${LIBRARY}.so.${VERSION} ${LIBRARY}_pic.a
  49.  
  50. cp ${LIBRARY}_pic.a ${LIBRARY}.so.${VERSION} ../lib
  51. ln -s ../lib/${LIBRARY}.so.${VERSION} ../lib/${LIBRARY}.so
  52.